﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SMALLERP;

namespace XJLSC.QM
{
    public partial class LXPCCS : Form
    {
        public delegate void Cdpccs(object sender, EventArgs e);
        //定义委托对象
        public Cdpccs cdpccs;
        public event EventHandler DataSelected;

        public LXPCCS()
        {
            InitializeComponent();
        }
        public double dpsl
        {
            get
            {
                return _dpsl;
            }
        }
        double _dpsl;


        /// <summary>
        /// 用户名
        /// </summary>
        public double dbcl
        {
            get
            {
                return _dbcl;
            }
        }
        double _dbcl;

        public int pcts
        {
            get
            {
                return _pcts;
            }
        }
        int _pcts;

        private void LXPCCS_Load(object sender, EventArgs e)
        {
            textBox1.Text = WTLXPCCS.DP.ToString();
            textBox2.Text = WTLXPCCS.BC.ToString();
            textBox3.Text = WTLXPCCS.TS.ToString();
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.DataSelected != null)
            {
                this._dpsl = Convert.ToDouble(textBox1.Text);
                this._dbcl = Convert.ToDouble(textBox2.Text);
                this._pcts = Convert.ToInt16(textBox3.Text);
                this.DataSelected(null, null);
            }
            this.Close();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

            if (textBox2.Text == "0" || textBox2.Text == "")
            {
                textBox3.Text = "0";
            }

            else
            {
                int ts = 0;
                ts = Convert.ToInt16(Convert.ToDouble(textBox1.Text) / Convert.ToDouble(textBox2.Text)) + 1;
                textBox3.Text = ts.ToString();
            }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

            if (textBox2.Text == "0" || textBox2.Text == "")
                {
                    textBox3.Text = "0";
                }

                else
                {
                    int ts = 0;
                    ts =Convert.ToInt16(Convert.ToDouble(textBox1.Text) / Convert.ToDouble(textBox2.Text))+1;
                    textBox3.Text = ts.ToString();
                }
            }
        
        
    }
}
